package com.zl.redisscheduler;

import com.zl.redisscheduler.core.DefaultTaskManager;
import com.zl.redisscheduler.core.RTaskScheduler;
import com.zl.redisscheduler.core.RedisOp;
import com.zl.redisscheduler.drivers.jedis.JedisDriver;
import redis.clients.jedis.JedisPool;

import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;

/**
 *
 *
 * @date 2021/4/8 11:16
 * @author Lizhong
 */
public class Test {
    public static void main(String[] args) throws InterruptedException {

        String HOST = "47.104.237.35";
        int PORT = 6379;


        JedisPool jedisPool = new JedisPool(HOST, PORT);
        JedisDriver jedisDriver = new JedisDriver(jedisPool);
        RTaskScheduler rschdule = new RTaskScheduler(new DefaultTaskManager(), new RedisOp(jedisDriver), "rschdule");
        rschdule.scheduleFixRateAt("123", () -> {
            System.out.println(LocalDateTime.now());
        }, 0, 3, TimeUnit.SECONDS);

        Thread.sleep(100000);
    }
}
